using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace RTMBindings.Responses
{
    public class RTMTaskSeries
    {
        [XmlArray("tags")]
        [XmlArrayItem("tag")]
        public List<RTMTag> Tags { get; set; }

        //[XmlArrayItem("participants")]
        //public List<RTMParticipants> Participants { get; set; }

        [XmlArray("notes")]
        [XmlArrayItem("note")]
        public List<RTMNote> Notes { get; set; }

        [XmlElement("task")]
        public RTMTask Task { get; set; }

        [XmlAttribute("id")]
        public int Id { get; set; }

        [XmlAttribute("created")]
        public DateTime Created { get; set; }

        [XmlAttribute("modified")]
        public string ModifiedString { get; set; }

        [XmlIgnore]
        public DateTime? Modified
        {
            get
            {
                if (string.IsNullOrEmpty(ModifiedString))
                    return null;
                return DateTime.Parse(ModifiedString);
            }
        }

        [XmlAttribute("name")]
        public string Name { get; set; }

        [XmlAttribute("api")]
        public string Api { get; set; }

        [XmlAttribute("url")]
        public string Url { get; set; }

        [XmlAttribute("location_id")]
        public string LocationId { get; set; }
    }
}